package me.firstapp.repository.weixin.transfer.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import me.firstapp.module.weixin.transfer.TransferMemberProductItem;
import me.firstapp.repository.base.impl.EntityRepositoryImpl;
import me.firstapp.repository.weixin.transfer.TransferMemberProductItemRepository;

@Repository
public class TransferMemberProductItemRepositoryImpl extends EntityRepositoryImpl<TransferMemberProductItem>
		implements TransferMemberProductItemRepository {

	@Override
	protected Class<TransferMemberProductItem> getPersistentClass() {
		return TransferMemberProductItem.class;
	}

	@Override
	public List<TransferMemberProductItem> findByTransferMemberProductId(Long transferMemberProductId) {
		StringBuilder sql = new StringBuilder(" FROM TransferMemberProductItem bean WHERE 1=1 ");
		Map<String, Object> parameters = new HashMap<>();

		sql.append(" AND bean.transferMemberProductId = :transferMemberProductId ");
		parameters.put("transferMemberProductId", transferMemberProductId);

		return super.query(TransferMemberProductItem.class, sql.toString(), parameters);
	}

}
